<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;

class QQMail extends Mailable
{
    use Queueable, SerializesModels;

    public $subject;
    public $content;
    /**
     * 创建一个新的邮件实例。
     *
     * @param string $subject 邮件主题
     * @param string $content 邮件内容
     */
    public function __construct($subject, $content)
    {
        $this->subject = $subject;
        $this->content = $content;
    }

    /**
     * Get the message envelope.
     */
    public function envelope(): Envelope
    {
        return new Envelope(
            subject: 'Q Q Mail',
        );
    }

    /**
     * 构建邮件消息。
     *
     * @return $this
     */
    public function build()
    {
        return $this->subject($this->subject)
                    ->view('emails.qq_mail') // 确保路径正确
                    ->with([
                        'content' => $this->content,
                    ]);
    }
}
